﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;

namespace LabMS.Web.LabPersonnel
{
    public partial class picShow : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Buffer = true;
            Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
            Response.Expires = 0;
            Response.CacheControl = "no-cache";
            if (Request.QueryString["ID"] != null)
            {
                int StaffID = int.Parse(Request.QueryString["ID"]);
                LabMS.BLL.Staff staff = new LabMS.BLL.Staff();
                LabMS.Model.Staff staffinfo = new LabMS.Model.Staff();

                staffinfo = staff.GetModel(StaffID); 
                byte[] PhotoArray = staffinfo.Staff_Photo;

                string PhotoType = staffinfo.Staff_PhotoType;
                if (PhotoArray.Length != 0)
                {
                    Response.ContentType = PhotoType;
                    Response.BinaryWrite(PhotoArray);
                    Response.End();
                }
            }
        }
    }
}
